package connect3.team7.game;

import java.net.InetAddress;
import connect3.team7.gui.*;
import connect3.team7.util.IPUtil;

public class Player implements java.io.Serializable {
  private static final long serialVersionUID = 227L;
  private String name;
  private String ip_addr;
  private String token_image;
  private boolean hostPlayer;
  
  public boolean isHost() {
      return this.hostPlayer;
  }
  
  public void setHost(boolean b) {
      this.hostPlayer = b;
  }
  
  public String getTokenImage() {
      return this.token_image;
  }
  
  public void setTokenImage(String s) {
      this.token_image = s;
  }

  public Player(String name, boolean host) {
    super(); 
    setName(name); 
    setIpAddr();
    setHost(host);
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getName() {
    return this.name;
  }

  public void setIpAddr() {
    try {
      this.ip_addr = IPUtil.getHostIP();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public String getIpAddr() {
    return this.ip_addr;
  }
}
